<template>
    <div class="app-container">

        <!--Header-->
        <!-- <mt-header fixed title="标题过长会隐藏后面的内容啊哈哈哈哈">
            <a @click="go" slot="left" v-if="showBackButton">
                <mt-button icon="back"></mt-button>
            </a>
        </mt-header> -->        

        <!--Main-->
        <transition>
            <router-view></router-view>
        </transition>

        <!--TabBar-->
        <nav class="mui-bar mui-bar-tab">
            <router-link class="mui-tab-item2" to="/home">
                <!-- <span class="mui-icon mui-icon-home"></span> -->
                <span class="mui-icon"><i class="iconfont icon-51"></i></span>
                <span class="mui-tab-label">首页</span>
            </router-link>
            <router-link class="mui-tab-item2" to="/newlist">
                <span class="mui-icon"><i class="iconfont icon-xinwen"></i></span>
                <span class="mui-tab-label">新闻</span>
            </router-link>
            <router-link class="mui-tab-item2" to="/goods">
                <span class="mui-icon"><i class="iconfont icon-faxian"></i></span>
                <span class="mui-tab-label">发现</span>
            </router-link>
            <router-link class="mui-tab-item2" to="/cart">
                <span class="mui-icon mui-icon-extra mui-icon-extra-cart">
                    <span class="mui-badge" id="cartBadge">{{this.$store.getters.getTotalQuantity}}</span>
                </span>
                <span class="mui-tab-label">购物车</span>
            </router-link>
            <router-link class="mui-tab-item2" to="/user">
                <span class="mui-icon"><i class="iconfont icon-wode"></i></span>
                <span class="mui-tab-label">未登录</span>
            </router-link>
        </nav>
    </div>
</template>

<script>
    import './static/public/base.scss'
    import './static/public/main.scss'
    export default {
        data() {
            return {
                keyword: '请输入关键字搜索',
                showBackButton:true//显示返回按钮
            }
        },
        methods:{
            // go(){
            //     this.$router.go(-1);
            // },
            //如果当前在首页就不显示返回按钮
            // clickHomeTabbar(){
            //     this.showBackButton=false;
            // }
        }
    }
</script>
<style lang="scss">
    *{
        padding: 0;
        margin: 0;
    }
    ul,li{
        list-style: none;
    }
    html,body {
        background-color: #fff;
        height: 100%;
    }
    .app-container{
        max-width: 750px;
        height: 100%;
        margin: 0 auto;
    }
    .main-container{
        padding: 45px 0 50px 0;
        // height: 100%;
    }
/*
    .lazy-img[lazy=loading]{
        // position: absolute;
        // left: 0;
        // right: 0;
        // margin: auto;
        // top: 0;
        // bottom: 0;
        // transition: all .5s ease-in;
        opacity: 0;
    }

                .lazy-img[lazy=loaded],.lazy-img[lazy=error] {
                    // width: 40px;
                    // height: 300px;
                    // margin: auto;
                    opacity: 1;
                }
                */
</style>

<style lang="scss" scoped>    
    .app-container {
        /* padding: 40px 0 50px 0; */
        overflow-x: hidden;
    }

    .mint-header.is-fixed {
        z-index: 10;
    }

    /* 动画 */

    .v-enter {
        opacity: 0;
        transform: translateX(100%);
    }

    /* 离开向相反方向 */

    .v-leave-to {
        opacity: 0;
        position: absolute;
        transform: translateX(-100%);
    }

    /* v-enter-active 【入场动画的时间段】 */

    /* v-leave-active 【离场动画的时间段】 */

    .v-enter-active,
    .v-leave-active {
        transition: all 0.5s ease;
    }

    /* 
        解决 .mui-tab-item 和 MUI 图片分享页面头部滑动JS冲突，导致tabbar 无法切换组件的问题 
        .mui-tab-item 改为 .mui-tab-item2
    */

    .mui-bar-tab .mui-tab-item2.mui-active {
        color: #007aff;
    }

    .mui-bar-tab .mui-tab-item2 {
        display: table-cell;
        overflow: hidden;
        width: 1%;
        height: 50px;
        text-align: center;
        vertical-align: middle;
        white-space: nowrap;
        text-overflow: ellipsis;
        color: #929292;
    }

    .mui-bar-tab .mui-tab-item2.mui-active {
        color: #007aff;
    }

    .mui-bar-tab .mui-tab-item2 .mui-icon~.mui-tab-label {
        font-size: 11px;
        display: block;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .mui-bar-tab .mui-tab-item2 .mui-icon {
        top: 3px;
        width: 24px;
        height: 24px;
        padding-top: 0;
        padding-bottom: 0;
    }

    .mui-bar-tab .mui-tab-item2 .mui-icon {
        top: 3px;
        width: 24px;
        height: 24px;
        padding-top: 0;
        padding-bottom: 0;
    }
</style>